if exists('g:loaded_find_api')
    finish
endif

let g:loaded_find_api = 1

let s:apis_funs_file = expand('<sfile>:p:h:h') . '/apis/funs.txt'

function! s:findApi(key)
    let funs = find_api#get_funs()
    if has_key(funs, a:key)
        echo a:key.':'
        for [d, v] in items(funs[a:key])
            echo "\t".d.': '.join(v,', ')
        endfor
        echo ''
    endif
    for [k, t] in items(funs)
        if stridx(k, a:key) >= 0 && a:key != k
            echo k.':'
            for [d, v] in items(t)
                echo "\t".d.': '.join(v,', ')
            endfor
            echo ''
        endif
    endfor
endfunction

command! -nargs=1 FindApi call s:findApi('<args>')
